home *** CD-ROM | disk | FTP | other *** search
/ Freelog 115 / FreelogNo115-MaiJuin2013.iso / Internet / Filezilla Server / FileZilla_Server-0_9_41.exe / source / interface / misc / hyperlink.h < prev    next >
C/C++ Source or Header  |  2011-11-06  |  4KB  |  137 lines

  1. // HyperLink.h : header file
  2. //
  3. //
  4. // HyperLink static control.
  5. //
  6. // Copyright Giancarlo Iovino, 1997 (giancarlo@saria.com)
  7. // This code is based on CHyperlink by Chris Maunder.
  8. // Feel free to use and distribute. May not be sold for profit. 
  9.  
  10. #if !defined(AFX_HYPERLINK_H_04ET323B01_023500_0204251998_ENG_INCLUDED_)
  11. #define AFX_HYPERLINK_H_04ET323B01_023500_0204251998_ENG_INCLUDED_
  12.  
  13. #if _MSC_VER >= 1000
  14. #pragma once
  15. #endif // _MSC_VER >= 1000
  16.  
  17. // Structure used to get/set hyperlink colors
  18. typedef struct tagHYPERLINKCOLORS {
  19.     COLORREF    crLink;
  20.     COLORREF    crActive;
  21.     COLORREF    crVisited;
  22.     COLORREF    crHover;
  23. } HYPERLINKCOLORS;
  24.  
  25.  
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CHyperLink window
  28.  
  29. class CHyperLink : public CStatic
  30. {
  31.     DECLARE_DYNAMIC(CHyperLink)
  32.  
  33. public:
  34. // Link styles
  35.     static const DWORD StyleUnderline;
  36.     static const DWORD StyleUseHover;
  37.     static const DWORD StyleAutoSize;
  38.     static const DWORD StyleDownClick;
  39.     static const DWORD StyleGetFocusOnClick;
  40.     static const DWORD StyleNoHandCursor;
  41.     static const DWORD StyleNoActiveColor;
  42.  
  43. // Construction/destruction
  44.     CHyperLink();
  45.     virtual ~CHyperLink();
  46.  
  47. // Attributes
  48. public:
  49.  
  50. // Operations
  51. public:    
  52.     static void GetColors(HYPERLINKCOLORS& linkColors);
  53.  
  54.     static HCURSOR GetLinkCursor();
  55.     static void SetLinkCursor(HCURSOR hCursor);
  56.     
  57.     static void SetColors(COLORREF crLinkColor, COLORREF crActiveColor, 
  58.                    COLORREF crVisitedColor, COLORREF crHoverColor = -1);
  59.     static void SetColors(HYPERLINKCOLORS& colors);
  60.  
  61.     void SetURL(CString strURL);
  62.     CString GetURL() const;
  63.  
  64.     DWORD GetLinkStyle() const;
  65.     BOOL ModifyLinkStyle(DWORD dwRemove, DWORD dwAdd, BOOL bApply=TRUE);    
  66.     
  67.     void SetWindowText(LPCTSTR lpszText);
  68.     void SetFont(CFont *pFont);
  69.     
  70.     BOOL IsVisited() const;
  71.     void SetVisited(BOOL bVisited = TRUE);
  72.     
  73.     // Use this if you want to subclass and also set different URL
  74.     BOOL SubclassDlgItem(UINT nID, CWnd* pParent, LPCTSTR lpszURL=NULL) {
  75.         m_strURL = lpszURL;
  76.         return CStatic::SubclassDlgItem(nID, pParent);
  77.     }
  78.  
  79. // Overrides
  80.     // ClassWizard generated virtual function overrides
  81.     //{{AFX_VIRTUAL(CHyperLink)
  82.     public:
  83.     virtual BOOL PreTranslateMessage(MSG* pMsg);    
  84.     protected:
  85.     virtual void PreSubclassWindow();    
  86.     //}}AFX_VIRTUAL
  87.  
  88. // Implementation
  89. protected:
  90.     static void SetDefaultCursor();
  91.     static LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
  92.     static void ReportError(int nError);    
  93.     static HINSTANCE GotoURL(LPCTSTR url, int showcmd);
  94.  
  95.     void AdjustWindow();    
  96.     void FollowLink();
  97.     inline void SwitchUnderline();
  98.     
  99. // Protected attributes
  100. protected:
  101.     static COLORREF g_crLinkColor;        // Link normal color
  102.     static COLORREF g_crActiveColor;    // Link active color
  103.     static COLORREF g_crVisitedColor;    // Link visited color
  104.     static COLORREF g_crHoverColor;        // Hover color
  105.     static HCURSOR  g_hLinkCursor;        // Hyperlink mouse cursor
  106.  
  107.     BOOL     m_bLinkActive;                // Is the link active?
  108.     BOOL     m_bOverControl;            // Is cursor over control?
  109.     BOOL     m_bVisited;                // Has link been visited?
  110.     DWORD     m_dwStyle;                    // Link styles
  111.     CString  m_strURL;                    // Hyperlink URL string
  112.     CFont    m_Font;                    // Underlined font (if required)    
  113.     CToolTipCtrl m_ToolTip;                // The link tooltip    
  114.  
  115.     // Generated message map functions
  116. protected:
  117.     //{{AFX_MSG(CHyperLink)
  118.     afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
  119.     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  120.     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  121.     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  122.     afx_msg void OnSetFocus(CWnd* pOldWnd);
  123.     afx_msg void OnKillFocus(CWnd* pNewWnd);
  124.     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  125.     afx_msg LRESULT OnNcHitTest(CPoint point);
  126.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  127.     //}}AFX_MSG
  128.     DECLARE_MESSAGE_MAP()
  129. };
  130.  
  131. /////////////////////////////////////////////////////////////////////////////
  132.  
  133. //{{AFX_INSERT_LOCATION}}
  134. // Microsoft Developer Studio will insert additional declarations immediately before the previous line
  135.  
  136. #endif // !defined(AFX_HYPERLINK_H_04ET323B01_023500_0204251998_ENG_INCLUDED_)
  137.